<?php
namespace model;

class images
{
    const TABLE = "images";
    const TABLE_IMAGES = "images_image";

	private static function db($table = null)
	{
		return \libs\db::Init($table);
	}
   //查询数据列表
   public static function selectData()
   {
		$where['status'] = 1;
        return self::db(self::TABLE)->where($where)->limit(6)->cache(6600)->select();
   }
   public static function listData()
    {
		$where['status'] = 1;
		$p = ROUTE['query']['p'];
        $num = 20;  //每页显示条数
        $page = ['num' => $num, 'p' => $p, 'return' => ['prev', 'next', 'first', 'last', 'list']];
		$result['data'] = self::db(self::TABLE)->page($page)->order('id DESC')->select();
        $result['page'] = self::db(self::TABLE)->getPage();
        return $result;
    }
   
   //查询数据列表
   public static function selectImageData()
   {
		$where['aid'] = ROUTE['query']['id'];
        return self::db(self::TABLE_IMAGES)->where($where)->cache(6600)->select();
   }

}
